char-props
Utility for looking up line and column of a character at a given index and vice versa.
Getting Started
Install the module with: npm install charProps
Documentation
Examples
Initial load
var charProps = require('char-props'),
jquerySrc = fs.readFileSync('jquery.js', 'utf8');
var jqueryProps = charProps(jquerySrc);
lineAt usage
jqueryProps.lineAt(42);
columnAt usage
jqueryProps.columnAt(88);
indexAt usage
jqueryProps.indexAt({'line': 9000, 'column': 1});
charAt usage
jqueryProps.charAt({'line': 20, 'column': 20});
lineAt advanced usage
jqueryProps.lineAt(9001, {'minLine': 99});
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint your code via grunt and test via vows.
License
Copyright (c) 2012 Todd Wolfson
Licensed under the MIT license.